const vue = require("rollup-plugin-vue");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
const ts = require("rollup-plugin-typescript");
const json = require("@rollup/plugin-json");
const scss = require("rollup-plugin-scss");

const path = require("path");
module.exports = {
  input: path.resolve(__dirname, "./packages/index.ts"),
  output: [
    {
      file: "dist/x-ui2.cjs",
      format: "cjs",
      sourcemap: true,
    },
    {
      file: "dist/x-ui2.umd.js",
      format: "umd",
      globals: {
        vue: "Vue",
      },
      name: "bundle",
      sourcemap: true,
    },
    {
      file: "dist/x-ui2.mjs",
      format: "es",
      sourcemap: true,
    },
  ],
  treeshake: true,
  external: ["vue"],
  plugins: [
    ts({
      exclude: "node_modules/**",
      typescript: require("typescript"),
    }),
    nodeResolve({
      extensions: [".mjs", ".js", ".json", ".ts"],
    }),
    vue(),
    json(),
    commonjs(),
    scss({
      fileName: "x-ui2.css",
    }),
  ],
};
